package com.cy.pj.sys.dao;

//import com.cy.pj.common.pojo.CheckBox;
import com.cy.pj.common.pojo.CheckBox;
import com.cy.pj.sys.pojo.SysRole;
import com.cy.pj.sys.pojo.SysRoleMenu;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author 张琪
 * @date 2020/11/16
 * @describe 实际生产中, 每一张表对应一个Dao
 */
@Mapper
public interface SysRoleDao {

    List<SysRole> findPageObjects1(String name, Integer startIndex, Integer pageSize);

    int getRowCount(String name);

    int insertObject(SysRole sysRole);

//    @Select("select id, name, note from sys_roles where id = #{id}")
//    自动绑定到SysRoleMenu对象中
    SysRoleMenu findById(Integer id);

    int updateObject(SysRole sysRole);

    @Delete("delete from sys_roles where id = #{id}")
    int deleteObjectById(Integer id);

    @Select("select id, name from sys_roles")
    List<CheckBox> findObjects();

}
